#ifndef _DEV_DATA_IO_H_
#define _DEV_DATA_IO_H_

#ifdef __cplusplus
extern "C" {
#endif


struct temperature_report_s{
	float temperature;   /* unit: degree  */
};

struct brightness_report_s{
	float b[4];      /* unit: lm, order is RGBW  */ 
};

struct baro_report_s{
	float pressure;      /* unit: mbar  */ 
	float temperature;   /* unit: degree  */
};

struct acc_report_s{
	float data[3];       /* unit: m/s^2  */ 
	float temperature;    /* unit: degree  */
};

struct gyro_report_s{
	float data[3];        /* unit: rad/s  */ 
	float temperature;    /* unit: degree  */
};

struct mag_report_s{
	float data[3];        /* unit: mguess  */ 
	float temperature;   /* unit: degree  */
};

struct imu_report_s{
	struct acc_report_s  acc;
	struct gyro_report_s gyro;
};

struct imu_fifo_report_s{
    unsigned char samples;
    struct imu_report_s reports[32];
};

struct mmWave_radar_report_s{
    float vel;
};


struct encoder_report_s{
    int position[8];
    int valid_channels;
};

#define PWM_CHANNEL_MAX    16

struct pwm_data_s{
    float frequency;
    float duty_cycle[PWM_CHANNEL_MAX];
    unsigned char valid_channels;
};

struct lcd_string_s{
    int x;
    int y;
    char *str;
};

struct rgb_color_s{
    unsigned char red;
    unsigned char green;
    unsigned char blue;
};

enum gpio_mode_e{
    GPIO_MODE_INPUT = 1,
    GPIO_MODE_OUTPUT,
};

struct gpio_info_s{
    unsigned int  pin;
    unsigned char status;
    unsigned char mode;
};

enum ioctl_cmd_s{
    IO_CMD_USR1 = 0x1000,
    IO_CMD_USR2,
    IO_CMD_USR3,
    IO_CMD_SET_RANGE1,
    IO_CMD_SET_RANGE2,
    IO_CMD_SET_RANGE3,
};


// Flash 操作结构体
struct flash_program_s {
    unsigned int addr;           // 目标地址
    unsigned int data;           // 数据（单字/半字）
};

// Flash 扇区信息结构体
struct flash_sector_s {
    unsigned int addr;           // 扇区起始地址
    unsigned int size;           // 扇区大小
};

// Flash 描述结构体
struct flash_describer_s {
    unsigned int sector_num;     // 扇区数量
    struct flash_sector_s *sectors; // 扇区信息数组
};

// Flash 操作命令
enum flash_ioctl_cmd_e {
    FLASH_CTRL_ERASE_SECTOR = 0x01,  // 擦除指定扇区
    FLASH_CTRL_PROGRAM_WORD,         // 编程一个字
    FLASH_CTRL_PROGRAM_HALF,         // 编程半个字
    FLASH_CTRL_LOCK,                 // 锁定 Flash
    FLASH_CTRL_UNLOCK,               // 解锁 Flash
    FLASH_CTRL_ERASE_ALL,            // 全片擦除
};

#ifdef __cplusplus
}
#endif

#endif
